package table_host;

import android.os.Bundle;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ToggleButton;

import com.google.zxing.client.android.CaptureActivity;

import tangyaxin.www.saoerweima.BaseFragment;
import tangyaxin.www.saoerweima.R;

/**
 * Created by Administrator on 2016/6/7.
 */
public class ScanActivity extends CaptureActivity {
    private View addBtn;
    private ToggleButton flashLightBtn;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        findView();
        initView();
    }

    @Override
    protected void onResume() {
        super.onResume();
        showViewFindView(false);
    }

    protected void findView() {
        getRootLayoutView().addView(View.inflate(this,R.layout.frament_scan,null));
        addBtn = findViewById(R.id.state_btn);
        flashLightBtn = (ToggleButton) findViewById(R.id.flash_tohhle);

//        new AdWindow(ScanSubActivity.this).showAtLocation(addBtn, Gravity.BOTTOM,0,50);
    }

    protected void initView() {
        addBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO: 2016/6/27  从手机相册选取一张二维码相片进行识别
            }
        });

        flashLightBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                cameraManager.toggleCameraFlashLight(isChecked);
            }
        });
    }

}
